<template>
    <div class="body addres_list">
        <div
            class="jd_listaddless p"
            v-for="(item, index) in address_list"
            :key="index"
        >
            <div class="maleri30">
                <div class="name fl">
                    <h1>{{ item.consignee }}</h1>
                </div>
                <div class="numberaddress fl">
                    <span class="number">
                        <i>{{ item.mobile }}</i>
                        <b v-show="item.is_default == 1">默认</b>
                        <b v-show="item.type == 1">家</b>
                        <b v-show="item.type == 2">公司</b>
                    </span>
                    <span class="similars">
                        {{ item.province_name }}
                        {{ item.city_name }}
                        {{ item.district_name }}
                        {{ item.address }}
                    </span>
                </div>
                <div class="editdiv fl">
                    <a>
                        <i
                            class="eedit"
                            @click="
                                $router.push({
                                    path: '/address_edit',
                                    query: { address_id: item.address_id },
                                })
                            "
                        ></i>
                    </a>
                </div>
            </div>
        </div>

        <!-- 缺省页面 -->
        <component
            :is="'ContentNone'"
            :isgoShop="false"
            v-show="address_list.length == 0"
        ></component>

        <div class="j_newbutton">
            <div class="j_newbtn" @click="$router.push('/address_edit')">
                +新增地址
            </div>
        </div>
        <div class="zhanwei"></div>
    </div>
</template>

<script>
import { axiosPost } from '../../axios';
// import { Toast } from 'vant';
export default {
    name: '',
    data() {
        return {
            address_list: {},
        };
    },
    computed: {},
    mounted() {
        this.getAddreslist();
    },
    methods: {
        getAddreslist() {
            axiosPost('/api/user/address_list', {}, (res) => {
                // console.log(res);
                this.address_list = res.data.address_list;
            });
        },
    },
};
</script>

<style lang="less" scope>
.j_newbutton {
    position: fixed;
    left: 0;
    bottom: 0.5rem;
}

.addres_list {
    .jd_listaddless {
        border-bottom: 1px solid #e5e5e5;
        padding: 0.64rem;
        cursor: pointer;
        width: 15.1467rem;
        height: 2.8373rem;
        margin: 0.64rem auto 0;
        background: #fff;
        border-radius: 0.4267rem;
        position: relative;
    }

    .jd_listaddless .name h1 {
        font-size: 0.6827rem;
        font-weight: 500;
        color: #000000;
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
    }

    .jd_listaddless .numberaddress {
        margin-top: 0.1rem;
    }

    .jd_listaddless .numberaddress .number {
        font-size: 0.5973rem;
        font-weight: normal;
        margin-top: 0.1rem;
    }

    .jd_listaddless .name {
        width: auto;
        margin-right: 0.1rem;
    }

    .jd_listaddless .editdiv {
        position: inherit;
    }

    .jd_listaddless .editdiv .eedit {
        background: url(../../assets/newimg/user/my_icon_xiugai.png) center
            center no-repeat;
        background-size: 0.576rem auto;
        width: 0.81067rem;
        height: 0.85333rem;
        position: absolute;
        top: auto;
        right: 0.74rem;
        bottom: 0.8rem;
        margin-left: 0.85333rem;
        cursor: pointer;
    }

    .jd_listaddless .numberaddress .similars {
        padding: 0.42667rem 0;
        font-size: 0.55rem;
        line-height: 0.768rem;
        display: block;
        color: #666;
        position: absolute;
        left: 0.74rem;
        bottom: 0;
        font-size: 0.5547rem;
        font-weight: 400;
        color: #000000;
        text-overflow: ellipsis;
        overflow: hidden;
        white-space: nowrap;
        max-width: 13rem;
        margin-left: 0.1rem;
    }

    .jd_listaddless .maleri30 {
        overflow: inherit;
    }

    .number b {
        background: #ff9a1e;
        border-radius: 0.0853rem;
        font-size: 0.512rem;
        font-weight: normal;
        color: #ffffff;
        padding: 0.0953rem 0.2133rem;
        margin-left: 0.2rem;
    }

    .createnew {
        width: 13.0133rem;
        height: 2.1333rem;
        text-align: center;
        position: fixed;
        bottom: 1.28rem;
        cursor: pointer;
        left: 1.472rem;
        overflow: hidden;
    }

    .createnew a {
        width: 100%;
        font-size: 0.7253rem;
        color: white;
        background-color: #f23030;
        border-radius: 1.0667rem;
        text-align: center;
        line-height: 2.1333rem;
        display: block;
        cursor: pointer;
    }
}
</style>
